﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using PFXDemo.Library;

namespace PFXDemo.Test
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class AdditionUnitTests
    {
        #region Stuff
        public static PFXAddition _pfxAddition;
        public AdditionUnitTests() { }

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        [ClassInitialize()]
        public static void TestClassSetup(TestContext testContext)
        {
            _pfxAddition = new PFXAddition();
        }
        #endregion

        [TestMethod]
        public void TestSequentialAdditionFor()
        {
            long total = _pfxAddition.SequentialAdditionFor();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestSequentialAdditionForEach()
        {
            long total = _pfxAddition.SequentialAdditionForEach();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForOuter()
        {
            long total = _pfxAddition.ParallelAdditionOuter();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForEachOuter()
        {
            long total = _pfxAddition.ParallelAdditionForEachOuter();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForInner()
        {
            long total = _pfxAddition.ParallelAdditionForInner();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForEachInner()
        {
            long total = _pfxAddition.ParallelAdditionForEachInner();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForBoth()
        {
            long total = _pfxAddition.ParallelAdditionForBoth();
            Assert.AreEqual(_pfxAddition.Total, total);
        }

        [TestMethod]
        public void TestParallelAdditionForEachBoth()
        {
            long total = _pfxAddition.ParallelAdditionForEachBoth();
            Assert.AreEqual(_pfxAddition.Total, total);
        }
    }
}